#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;

int n, k;
int a[MAXN];

map<int, vector<int>> b;
map<int, int> inv;

int idx;
int trie[MAXN * 32][2];
int hbit(int x) {
    int pos = 0;
    while (x) {
        x >>= 1;
        pos++;
    }
    return pos;
}
int query(int x) {
    int ans = 0, p = 0;
    for (int i = 30; i >= 0; i--) {
        int m = (x >> i) & 1;
        if (trie[p][!m]) {
            p = trie[p][!m];
            ans = ans * 2 + !m;
        }
        else {
            p = trie[p][m];
            ans = ans * 2 + m;
        }
    }
    return ans;
}

void insert(int x) {
    int p = 0;
    for (int i = 30; i >= 0; i--) {
        int m = (x >> i) & 1;
        if (!trie[p][m]) trie[p][m] = ++idx;
        p = trie[p][m];
    }
}

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> n >> k;

    int h = hbit(k);

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        int bid = a[i] >> h;
        b[bid].push_back(a[i]);
        inv[a[i]] = i;
    }

    if (k == 0) {
        cout << n << endl;
        for (int i = 1; i <= n; i++) cout << i << ' ';
        cout << endl;
        return 0;
    }

    vector<int> ans;
    for (auto [_, v] : b) {
        // init
        memset(trie, 0, 4 * 2 * (idx + 4));
        idx = 0;


        if (v.size() >= 2) {
            // 计算最大异或和 剑指offer原题
            bool flag = false;
            for (auto num : v) {
                insert(num);
                int q = query(num);

                if ((q ^ num) >= k) {
                    ans.push_back(inv[q]);
                    ans.push_back(inv[num]);
                    flag = true;
                    break;
                }
            }

            if (!flag) ans.push_back(inv[v[0]]);
        }
        else {
            ans.push_back(inv[v[0]]);
        }
    }
    if (ans.size() == 1) {
        cout << -1 << endl;
        return 0;
    }
    cout << ans.size() << endl;

    for (auto i : ans) cout << i << ' ';
    cout << endl;
    return 0;
}